﻿using Sprout.Schedule.Web.Exceptions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Sprout.Schedule.Web.Models
{
    public class ResponseResult
    {
        /// <summary>
        /// 状态码
        /// </summary>
        public StatusCodeEnum StatusCode { get; set; }
        /// <summary>
        /// 消息
        /// </summary>
        public string Message { get; set; }
        /// <summary>
        /// 是否成功
        /// </summary>
        public bool Success
        {
            get
            {
                if (StatusCode == StatusCodeEnum.Success)
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
        }
        /// <summary>
        /// 数据
        /// </summary>
        public object Data { get; set; }
        /// <summary>
        /// 默认实例
        /// </summary>
        public ResponseResult()
        {
            StatusCode = StatusCodeEnum.Success;
            Message = "";
        }
        /// <summary>
        /// 指定实例
        /// </summary>
        /// <param name="statusCode"></param>
        /// <param name="message"></param>
        public ResponseResult(StatusCodeEnum statusCode, string message)
        {
            StatusCode = statusCode;
            Message = message;
        }
    }
}
